package com.java.base.exercise.designmode.observer;

import org.apache.commons.collections4.CollectionUtils;

import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;

/**
 * @Author RenPu
 * @Date 2022/11/12 20:54
 * @Version 1.0
 * @Description: 观察者(山东气象局)
 **/
public class CurrentConditionDisply implements Observe {

    public CurrentConditionDisply(Subject weatherData) {
        weatherData.registerObser(this);
    }

    @Override
    public void update(int temper, int hindym, int press) {
        System.out.println("山东天气气象局播报==========当前温度为："+temper+"当前湿度为："+hindym+"当前压强为："+press);
    }

    public static void main(String[] args) {
        List<Object> list = new ArrayList<>(Arrays.asList(1,2,3));

        System.out.println(CollectionUtils.isNotEmpty(list)?list.get(0):null);
    }
}
